Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tests/lib/fakestore: add support for tracking channels #14840

Conversation

valentindavid
Copy link
Contributor

Cherry-pick of eb2a956 from #14305 in fde-manager-features branch.

@valentindavid valentindavid added the Run nested The PR also runs tests inluded in nested suite label Dec 10, 2024
Copy link
Member

@andrewphelpsj andrewphelpsj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! I think adding a test here for the channel functionality would be good.

@@ -447,6 +467,18 @@ func (s *Store) collectSnaps(bs asserts.Backstore) (map[string]*revisionSet, err

snaps[info.Name].add(snap.R(info.Revision), fn)

digest, _, err := asserts.SnapFileSHA3_384(fn)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The above info already carries the digest.

return nil, err
}
} else {
sc := bufio.NewScanner(fd)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing a defer fd.Close() in here.

@valentindavid valentindavid force-pushed the valentindavid/cherry-pick-fakestore-channels branch from 780172b to 49be6de Compare December 10, 2024 14:35
@@ -179,7 +197,9 @@ type essentialInfo struct {
Base string
}

func snapEssentialInfo(fn, snapID string, bs asserts.Backstore) (*essentialInfo, error) {
var errInfo = errors.New("cannot get info")
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure what this is. I have to remove it.

@valentindavid valentindavid force-pushed the valentindavid/cherry-pick-fakestore-channels branch from d696fb0 to 710aced Compare December 10, 2024 15:12
Copy link

codecov bot commented Dec 10, 2024

Codecov Report

Attention: Patch coverage is 73.33333% with 20 lines in your changes missing coverage. Please review.

Project coverage is 78.27%. Comparing base (24a0034) to head (4b8fe5d).
Report is 42 commits behind head on master.

Files with missing lines Patch % Lines
tests/lib/fakestore/store/store.go 73.33% 15 Missing and 5 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master   #14840      +/-   ##
==========================================
+ Coverage   78.20%   78.27%   +0.06%     
==========================================
  Files        1151     1154       +3     
  Lines      151396   152356     +960     
==========================================
+ Hits       118402   119258     +856     
- Misses      25662    25731      +69     
- Partials     7332     7367      +35     
Flag Coverage Δ
unittests 78.27% <73.33%> (+0.06%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@andrewphelpsj andrewphelpsj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

dgst, _, err := asserts.SnapFileSHA3_384(snapFn)
c.Assert(err, IsNil)

f, err := os.OpenFile(filepath.Join(s.store.blobDir, "channels", dgst), os.O_CREATE|os.O_WRONLY, 0644)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing a f.Close here.

Copy link
Member

@alfonsosanchezbeato alfonsosanchezbeato left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks

@valentindavid valentindavid force-pushed the valentindavid/cherry-pick-fakestore-channels branch from ac4ca39 to d076339 Compare December 12, 2024 10:06
@andrewphelpsj andrewphelpsj force-pushed the valentindavid/cherry-pick-fakestore-channels branch from d076339 to 4b8fe5d Compare December 16, 2024 20:20
@andrewphelpsj andrewphelpsj force-pushed the valentindavid/cherry-pick-fakestore-channels branch from 4b8fe5d to f8c78ca Compare December 18, 2024 14:02
@andrewphelpsj
Copy link
Member

This is an updated to the fake store, and none of the failing tests use the fake store.

google-nested:ubuntu-22.04-64:tests/nested/manual/uc-update-assets-secure-add-sbat
google-nested:ubuntu-24.04-64:tests/nested/manual/hybrid-remodel
google-nested:ubuntu-20.04-64:tests/nested/manual/core20-new-snapd-does-not-break-old-initrd:startwithnew
google-nested:ubuntu-24.04-64:tests/nested/manual/remodel-min-size

@ndyer ndyer merged commit 1f677f1 into canonical:master Dec 18, 2024
50 of 58 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Run nested The PR also runs tests inluded in nested suite
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants